package ru.sh.jewel;

import android.graphics.Rect;
import framework.GameConfig;
import framework.GameResources;
import framework.managers.SoundManager;
import framework.objects.DynamicGameObject;
import framework.objects.Getable;
import framework.objects.hero.Hero;

public abstract class Jewel extends DynamicGameObject implements Getable {

	public static final int GOOD_TYPE = 0;
	public static final int BAD_TYPE = 1;
	public static final int NEED_TYPE = 2;
	
	protected int type;
	
	protected Hero hero;
	
	public int getType() {
		return type;
	}
	
	protected float dy = 1;
	
	public Jewel(float x, Hero hero) {
		super();
		this.x = x;
		y = GameConfig.BASE_HEIGHT;
		this.hero = hero;
	}

	public void update(float deltaTime) {
		
		y -= dy;
		if (y < 0) alive = false;

	}
	
	public void onGet() {
		alive = false;
		SoundManager.play(GameResources.getSoundName(2));
	}
	
	@Override
	public Rect getRect() {
		return new Rect((int)x - width/4, (int)y - height/4, (int)x + width/4, (int)y + height/4);
	}

}
